<?php
	session_start();

	if(empty($_SESSION['admin_id'])){
		header('Location:admin_login.php');
	}
	

	define('IN_TG',true);	

	if(!empty($_POST['action'])){
		require 'commom.inc.php';
		$data = array();
		$title = $_POST['title'];
		$content = $_POST['content'];
		$contact = $_POST['contact'];
		$mobile = $_POST['mobile'];
		$info_type = $_POST['info_type'];
		$send_time = time();

		$sql =  "INSERT INTO nz_info VALUES(
				NULL,'$title','$content','$contact','$mobile','$send_time','$info_type'
			)";

		$bool = mysql_query($sql);
		//判断是否执行成功
		if($bool){
			echo '新增数据成功';
		}
		else{
			echo '新增数据失败'.mysql_error();
		}
	}

?>

<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>发布信息</title>
</head>
<body>

	<form action="admin.php" method="post">

		<p><label>标　题：<input type="text" name="title" /></label></p>
		<p><label>内　容：<input type="text" name="content" /></label></p>
		<p><label>联系人：<input type="text" name="contact" /></label></p>
		<p><label>手机号：<input type="text" name="mobile" /></label></p>
		<p><label>类　型：</label> 	
			<label>房屋<input type="radio" checked="checked" name="info_type" value="1" /></label>
			<label>工作<input type="radio" name="info_type" value="2" /></label>
		</p>
		<p><label><input type="submit" name="action" value="提交数据" /></label></p>
	</form>

</body>
</html>
